<template>
    <base-dialog  v-bind="$attrs" v-on="$listeners" :title="title" width="1000px" @submit="toAddCart" :is-view="disabled">
        <el-button @click="toAddCart" type="primary" v-if="isAddCart">加入物品清单</el-button>
        <simple-table api-url="goodsManagement/goods"  api-fun="getSimleList" :params="{id:row.id}" @selection-change="handleSelectionChange" height="500px" :showCheckBox="isAddCart" >
            <el-table-column align="left" prop="name" label="物品名"/>
            <el-table-column align="left" prop="price" label="单价"/>
            <el-table-column align="left" prop="stock" label="库存"/>

        </simple-table>
    </base-dialog>
</template>
<script>
    import BaseDialog from "../../../components/Common/BaseDialog";
    import DetailDialog from "@/mixins/DetailDialog";
    export default {
        name:"GoodsListDialog",
        mixins:[DetailDialog],
        data(){
          return {
              multipleSelection:[],
              goodsList:[]
          }
        },
        created() {
        },
        components: { BaseDialog},
        computed:{
            isAddCart(){
                return this.$route.path == '/onlineRepair/list'
            },
            title() {
                return "物品列表"
            },
        },
        methods:{
            handleSelectionChange(val){
                this.multipleSelection = val;
            },
            toAddCart(){
               this.$emit('complete',this.multipleSelection)
               this.close()
            },

        }
    }
</script>
